package com.lize.threaduse;

public class Tread02  {
    public static void main(String[] args) {
        Dog dog = new Dog();
        //接口形式不能调用start dog.start
        Thread thread = new Thread(dog);
         thread.start();
    }


    }
class Dog implements Runnable{
    int count=0;
    @Override
    public void run() {
        while (true){


            try {
                Thread.sleep(1000);
                System.out.println("小狗汪汪叫"+(++count)+Thread.currentThread().getName());
            } catch (Exception e) {
                e.printStackTrace();
            }

         if(count==10)
             break;
        }
    }
}